<?php
@session_start();

require_once("../model/application.php");

$app_id = $_POST['app_id'];

$_SESSION['app_id'] = $app_id; // luu xu ly session app_id

if($app_id && $app_id != null) {

    $list_app = new Applications();

    $data =  $list_app->getItemByID($app_id);

    // var_dump($data);
    echo "<p>Chi tiết sản phẩm </p>";

    echo "<ul>";
        echo "<li>Tên sản phẩm: ".$data['app_name']."</li>";
        echo "<li>Hiện trạng: ".$data['app_status']."</li>";
        echo "<li>Giá sản phẩm: ".$data['app_price']."<font color=\"green\"><b>$</b></font></li>";
        echo "<li>Lượt tải: ".$data['count_dl']."</li>";
        echo "<li>Mô tả: ".$data['app_desc']."</li>";
        if(isset($_SESSION['username'])) // neu ton tai user moi cho download
        {
            echo "<li><a href='controller/download1.php?file=".$data['app_path']."'>Download</a></li>";
        }
        else
        {
            echo "<li><a class='download' href='controller/download1.php?file=".$data['app_path']."'>Download</a></li>";
        }
    echo "</ul>";
}